﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Core.Base;
using System.ComponentModel;
using Base;
using System.Drawing;
using Core.Component;
using Core;
using Components;
using System.Web.UI.WebControls;

namespace Core.Component.WebForm
{
    //public class SGVTextBox: MaskedTextBox, IBindingControl, ISGVControl
    public class SGVScreen: System.Web.UI.WebControls.Panel, ISGVControl
    {
        BaseModule module;
        BaseEntity entity;
        String _sgvTag;
        public SGVScreen()
            :base()
        {
        }

        public Core.Component.UIComponent component
        {
            set;
            get;
        }

        public void RegisterModule(Core.Base.BaseModule _module)
        {
            if (_module != null)
            {
                this.module = _module;
                this.entity = _module.entity;
            }
        }
        public void Init()
        {
            
            //this.BackColor = Color.FromArgb(217, 214, 214);
        }

        public void UpdateFormat()
        {
            
        }

        String _sGVShortcutString;
        [CategoryAttribute(".SGV"), DescriptionAttribute("")]
        public String SGVShortcutString
        {
            get { return _sGVShortcutString; }
            set { _sGVShortcutString = value; }
        }
        [CategoryAttribute(".SGV"), DescriptionAttribute("")]
        public string SGVTag
        {
            get
            {
                return _sgvTag;
            }
            set
            {
                _sgvTag = value;
            }
        }

        public UIComponent Serialize()
        {
            return null;
        }

        public void Deserialize(UIComponent component)
        {
            this.component = component;
            SGVControlHelper.PopulateProperties(this, component);

            this.BorderStyle = System.Web.UI.WebControls.BorderStyle.Ridge;
            this.BackColor = Color.Transparent;

            foreach (UIComponent compChild in component.lstChilds)
            {
                System.Web.UI.Control webControlChild = SGVControlHelper.CreateWebControlFromUIComponent(compChild);
                if (webControlChild != null)
                    this.Controls.Add(webControlChild);
            }
        }
    }
}
